<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import ="com.dish.bean.Users,java.util.*,java.io.IOException
,java.sql.Connection
,java.sql.PreparedStatement
,java.sql.ResultSet
,java.sql.SQLException
,java.util.ArrayList
,javax.servlet.ServletException
,javax.servlet.annotation.WebServlet
,javax.servlet.http.HttpServlet
,javax.servlet.http.HttpServletRequest
,javax.servlet.http.HttpServletResponse
,com.dish.bean.Dish
,com.dish.utils.JDBCUtils
,java.io.IOException
,javax.servlet.ServletException
,javax.servlet.annotation.WebServlet
,javax.servlet.http.HttpServlet
,javax.servlet.http.HttpServletRequest
,javax.servlet.http.HttpServletResponse
" %>  
<%  
	request.setCharacterEncoding("utf-8");  
	String nm = request.getParameter("dishnm");
	String pri = request.getParameter("dishpri");
	String ds = request.getParameter("dishds");
	String img = request.getParameter("dishimg");
	   Connection conn = null;
	   PreparedStatement ps =null;
	   ResultSet rs = null;
   //out.println(id);  
   try {
		conn = JDBCUtils.getConnection();
		String sql = "insert into dish(name,price,description,img) values(?,?,?,?)";
		ps = conn.prepareStatement(sql);
		ps.setString(1, nm);
		ps.setDouble(2, Double.parseDouble(pri));
		ps.setString(3, ds);
		ps.setString(4, img);
		int fuck = ps.executeUpdate();
		response.sendRedirect("ShowDish"); 
	} catch (SQLException e) {
		e.printStackTrace();
	}finally {
		JDBCUtils.free(rs, ps, conn);
	}
%>  